package com.example.lenovo.musicplayerinit;

import android.app.Service;
import android.content.Intent;
import android.os.Binder;
import android.os.IBinder;
import android.support.annotation.Nullable;
import android.widget.Toast;

/**
 * Created by Lenovo on 2017/10/21.
 */

public class MusicPlayerService extends Service {
    @Override
    public void onCreate() {
        super.onCreate();
        System.out.println("准备一个音乐播放器");
    }

    @Override
    public IBinder onBind(Intent intent) {
        return new MyBinder();
    }
    public class MyBinder extends Binder{
        //  调用逻辑
        public void callNext() {
            Toast.makeText(getApplicationContext(),"下一首歌",Toast.LENGTH_SHORT).show();
        }
        public void callPre() {
            Toast.makeText(getApplicationContext(),"上一首歌",Toast.LENGTH_SHORT).show();
        }
        public void callPlay() {
            Toast.makeText(getApplicationContext(),"播放歌曲",Toast.LENGTH_SHORT).show();
        }
        public void callPause() {
            Toast.makeText(getApplicationContext(),"暂停歌曲",Toast.LENGTH_SHORT).show();
        }
    }
}
